<?php
/**
 * Extend Zend_Application_Resource_Translate
 * Auto select translate file by locale
 * 
 * @copyright  Copyright (c) 2011 Ricky Feng (http://code.google.com/p/rphp4zf)
 * @license    New BSD License
 */

class Mediad2_Application_Resource_Multidb extends Zend_Application_Resource_Multidb
{
    public function init()
    {
     
    	$resource = parent::init();
				
        $db1 = $resource->getDb('db1');
		//Zend_Db_Table对象设定默认的adapter
        Zend_Db_Table::setDefaultAdapter($db1);
        
        //设置数据库为utf8，解决UTF8或其他语系乱码问题        
        $db1->query("SET NAMES 'utf8'");
        
        //保存进注册表        
        Zend_Registry::set('db1', $db1);        
        return $resource;
               
    }
}

